10. Problems in the Data

Problems in the Data

Question:

Start Quiz:

Solution:

INSTRUCTOR NOTE:

Removing an Element from a Dictionary

If you're not sure how to remove an element from a dictionary, this post might be helpful.

Solutions

If you want to check our solution for the problem, look at the end of this lesson for Quiz Solutions.

Updated Code for Previous Exercise

After running the above code, Caroline also shows rewriting the solution from the previous exercise to the following code:

def get_unique_students(data):
    unique_students = set()
    for data_point in data:
        unique_students.add(data_point['account_key'])
    return unique_students
len(enrollments)
unique_enrolled_students = get_unique_students(enrollments)
len(unique_enrolled_students)
len(daily_engagement)
unique_engagement_students = get_unique_students(daily_engagement)
len(unique_engagement_students)
len(project_submissions)
unique_project_submitters = get_unique_students(project_submissions)
len(unique_project_submitters)